﻿from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response

def login(request):
    username = request.POST.get('email', None)
    if username:
        request.session['username'] = username
    username = request.session.get('username', None)

    if username:
        #print "======: " + username
        print "======:", username, username

        return render_to_response('logined.html', {'username':username})
    else:
        return render_to_response('login.html')

def logout(request):
    try:
        del request.session['username']
    except KeyError:
        pass
    return HttpResponseRedirect("/login/")

def register(request):
    username = request.POST.get('email', None)
    print "======:", username
    // 注册并跳转到用户欢迎页
    return render_to_response('register.html')

def hostmeeting(request):
    username = request.session.get('username', None)

    if username:
        return render_to_response('hostmeeting.html')
        #return render_to_response('logined.html', {'username':username})
    else:
        return render_to_response('login.html')

def joinmeeting(request):
    return render_to_response('hostmeeting.html')